import { getSysSip } from 'servers/sip';
import { getSocket } from 'servers/socket';
import { vpnCheckClear } from 'utils/vpnCheck';
import $http from 'servers/http';
/**退登-通用处理
 * jumpLogin-是否跳转登录页面
 */
export default function logoutSys(jumpLogin?: boolean) {
  // 清除登录数据
  localStorage.clear();
  // 清除缓存
  getSocket().disposeConnect();
  getSysSip().deleteSipConnect();
  // 清除VPN心跳监听
  vpnCheckClear();
  console.log('退出系统====✅，已成功清除缓存，断开Sip链接，断开vpn心跳监听');
  if (jumpLogin) {
    setTimeout(() => {
      window.location.href = '/webapp/login';
    }, 500);
  }
}
